home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
reply1.zip
/
REPLY.DOC
< prev
next >
Wrap
Text File
|
1988-07-28
|
7KB
|
174 lines
REPLY.COM
Created By: Charles Thurston
Of: Sunnyvale, CA
October 1987
This file contains the following:
1) A short description of the REPLY program.
2) An example of its use in a .BAT file.
3) A copy of the assembly program (REPLY.ASM).
******************************************************************************
This program is FREE, however, if you find it useful, please make a
contribution to any charity you wish, since that's where good money should go.
******************************************************************************
REPLY Description:
I have seen several programs out there which let the user make decisions
inside a .BAT process, and allow the user to change course in that process
based on the outcome. All of these programs have their good and bad points.
This program, REPLY.COM, combines what I consider to be all of their good
points into one routine.
REPLY has the following features:
a) REPLY's response parameters, those of which the user can choose
from, may be entered in any order.
b) If no valid response is received after 10 seconds, REPLY will
perform a DEFAULT response, which can also be used as a
parameter for the .BAT file to react upon.
c) While in the 10 second period, a response is entered which is
not valid, REPLY will ignore it and continue to wait for a
correct response of the end of the 10 second period.
c) All comments, to be used to prompt the user of his/her chooses,
are performed using "echo" statements prior to performing REPLY.
Therefore, the decision prompt is not limited to one line.
d) REPLY accepts response parameters of 1-9 and a-z.
1) Allowing for a total of 35 possible chooses.
2) All letters, a-z, are converted to upper case, so "a" and
"A" are considered the same response. This allows the user
the freedom of having the same response regardless of the
"Shift" or "Caps Lock" condition of their machine at the
time of their response.
1
e) REPLY checks the validity of all commend line parameters. If
there are any invalid, missing, or duplicate response
parameters, REPLY will output an error message.
REPLY parameters can be used in several ways. The following statements are
examples of REPLY commands:
REPLY 123456789abcdefghijklmnopqrstuvwxyz
or
REPLY 123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ
or
REPLY y
or even something weird like this
REPLY 1a3E4g2W7z9X
In a batch file after running REPLY, the "if errorlevel" command is used
to check which response parameter was chosen. The "if errorlevel" number to be
tested for each response parameter is assigned soully by the order in which the
parameters appear in the REPLY command line. For example:
REPLY 123456789abcdefghijklmnopqrstuvwxyz
| | |
| | |
"if errorlevel" code: "1" "16" "35"
The "if errorlevel" code for the 10 second timeout is "0".
Note: When using the "if errorlevel" batch command, the number tests must
always be checked in descending order, since the "if errorlevel" is
"True" if the test is "Greater than or equal".
******************************************************************************
Example Of Using REPLY In A .BAT File
An example of using REPLY in a .BAT file follows:
AUTOEXEC.BAT
echo off
echo ************************************************************
echo * ABORT TO DOS? (10 seconds to decide) *
echo * *
echo * Chooses: Y(yes) / N(no) or TIMEOUT @ End Of 10 Seconds *
echo ************************************************************
reply yn
if errorlevel 2 goto CONTINUE
if errorlevel 1 goto EXIT
rem **** continue with default option ****
....(1).......
............
..........
........
goto EXIT
:CONTINUE
....(2).......
............
..........
........
:EXIT
2
When this batch file is performed, the following will appear on the screen:
************************************************************
* ABORT TO DOS? (10 seconds to decide) *
* *
* Chooses: Y(yes) / N(no) or TIMEOUT @ End Of 10 Seconds *
************************************************************
RESPONSE: . . . . .
at which time a response may be entered. Another "." will appear each second
until a correct response of either "y" of "n" is entered, or the 10 seconds
elapses. If "n" is entered, an "N" will appear on the "RESPONSE" line, the
batch file will perform process (2) and exit. If "y" is entered, a "Y" will
appear and the batch file will exit. If the 10 second timeout occurs,
"DEFAULT" will appear, process (1) will be performed and exit.
******************************************************************************
REPLY.ASM Listing
For those of you who may wish to modify, or use portions of this routine
for other purposes, The following is the assembly program from which REPLY was
produced, and you're welcome to it.
[Toad Hall Note:
Removed the assembler source from this document and included it as a
separate REPLY.ASM file.
Extracted and tested a demo .BAT file (REPLYDEM.BAT) to test REPLY1.COM.
(Change the "reply1 yn" in that file to "reply yn" to test REPLY.COM.
Did a severe hack on REPLY.ASM:
- Removed some awkward code, tightened up things in general.
- Removed CPU speed-dependent timing loops (now using DOS master clock
ticks),
- Fixed up format and code to agree with MASM 5.0 (but didn't use the
"short" segment stuff, so it should still compile with earlier MASMs).
- Shortened .COM by about 40 bytes or so.
- Improved code included as REPLY1.ASM.
- Improved compiled program included as REPLY1.COM
David Kirschbaum, Toad Hall, 10 Jan 88, 28 Jul 88
kirsch@braggvax.ARPA
]